const path = require('path');
const fs = require('fs');
let lvResInProjPath = path.join(__dirname, "../../assets/GameAb/lv/")

const files = fs.readdirSync(lvResInProjPath); // 读取目录中的所有文件和文件夹

files.forEach(file => {
    const fullPath = path.join(lvResInProjPath, file);
    const stats = fs.statSync(fullPath); // 获取文件或文件夹的状态信息

    if (stats.isDirectory()) {
        console.log(`目录: ${fullPath}`);
        // 如果是目录，递归调用
        // traverseDirectorySync(fullPath, fileExt, outArray);
    } else {
        if (fullPath.indexOf("webp") >= 0) {
            let newName = fullPath.replace("webp", "png")
            fs.renameSync(fullPath, newName)
            console.log(`${fullPath}=>${newName}`)
        }
    }
});

console.log(`全部完成`)